<?php

define('BME_INSERTION',true);
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

require_once("../core/Base.php");
require_once(BME_ROOT."core/User.php");
require_once(BME_ROOT."gui/etc.php");


$_Usr = new BME_USER();

if ( BME_authentication_required() && !$_Usr->valid ) {
	setcookie("BME_pre_request",BME_get_request(),time()+1000*3600);
	BME_set_request("site/login");
}
if ( ( BME_get_request()=="site/login" || BME_get_request()=="site/index" ) && $_Usr->valid ) {
	BME_set_request("site/welcome");
}
ob_start("BME_localize");
$folders = array("menu");
$mod = $_REQUEST[$_REQUEST["module"]];

if($_REQUEST["module"]!='js' && $folder=BME_module_request($mod)){
	if(!in_array($folder,$folders)) $folder = "menu";
	include(BME_ROOT."gui/mod/$folder.php");
	echo 	"<img onload=\"AJAXer.request('".$_REQUEST["module"]."/".BME_content_request($mod)."','{$folder}_container');".
		"par=this.parentNode;if(par)par.removeChild(this);\" ".
		"src='".BME_SITE."img/ajax-loader.gif'/>";
}else{
	include(BME_ROOT."gui/mod/".$_REQUEST["module"].".php");
}
ob_end_flush();

?>
